public class Test {
    public static void main(String[] args) {
        String s2 = "abc";
        char[] ch = new char[]{'a','b','c'};
        String s1 = new String(ch);
        s1.intern();
        System.out.println(s1 == s2);
    }

    public static void main2(String[] args) {
        char[] ch = new char[]{'a','b','c'};
        String s1 = new String(ch);
        s1.intern();
        String s2 = "abc";
        System.out.println(s1 == s2);
    }


    public static void main3(String[] args) {
        char[] ch = new char[] {'a','b','c'};
    String s1 = new String("abc");
        s1.intern();
    String s2 = "abc";
        System.out.println(s1 == s2);
}


    public static void main1(String[] args) {
        String str1 = "abcd";
        String str2 = "abcd";
        String str3 = new String("abcd");
        String str4 = new String("abcd");
        System.out.println(str1 == str2);
        System.out.println(str3 == str4);
        System.out.println(str1 == str3);
    }


}
